package net.ufrog.common.weixin.pojos;

import java.io.Serializable;

import net.ufrog.common.dict.Element;

import com.thoughtworks.xstream.annotations.XStreamAlias;

/**
 * 消息
 * 
 * @author ultrafrog
 * @version 1.0, 2014-12-29
 * @since 1.0
 */
@XStreamAlias("xml")
public class Message implements Serializable {

	private static final long serialVersionUID = -5173361055313415886L;

	/** 目标用户 */
	@XStreamAlias("ToUserName")
	private String toUserName;
	
	/** 来源用户 */
	@XStreamAlias("FromUserName")
	private String fromUserName;
	
	/** 创建时间 */
	@XStreamAlias("CreateTime")
	private Long createTime;
	
	/** 消息类型 */
	@XStreamAlias("MsgType")
	private String msgType;
	
	/** 文本内容 */
	@XStreamAlias("Content")
	private String content;
	
	/** 消息编号 */
	@XStreamAlias("MsgId")
	private Long msgId;

	/** 构造函数 */
	public Message() {
		createTime = System.currentTimeMillis() / 1000;
	}
	
	/**
	 * 读取目标用户
	 * 
	 * @return
	 * @see #toUserName
	 */
	public String getToUserName() {
		return toUserName;
	}

	/**
	 * 设置目标用户
	 * 
	 * @param toUserName
	 * @see #toUserName
	 */
	public void setToUserName(String toUserName) {
		this.toUserName = toUserName;
	}

	/**
	 * 读取来源用户
	 * 
	 * @return
	 * @see #fromUserName
	 */
	public String getFromUserName() {
		return fromUserName;
	}

	/**
	 * 设置来源用户
	 * 
	 * @param fromUserName
	 * @see #fromUserName
	 */
	public void setFromUserName(String fromUserName) {
		this.fromUserName = fromUserName;
	}

	/**
	 * 读取创建时间
	 * 
	 * @return
	 * @see #createTime
	 */
	public Long getCreateTime() {
		return createTime;
	}

	/**
	 * 设置创建时间
	 * 
	 * @param createTime
	 * @see #createTime
	 */
	public void setCreateTime(Long createTime) {
		this.createTime = createTime;
	}

	/**
	 * 读取消息类型
	 * 
	 * @return
	 * @see #msgType
	 */
	public String getMsgType() {
		return msgType;
	}

	/**
	 * 设置消息类型
	 * 
	 * @param msgType
	 * @see #msgType
	 */
	public void setMsgType(String msgType) {
		this.msgType = msgType;
	}

	/**
	 * 读取文本内容
	 * 
	 * @return
	 * @see #content
	 */
	public String getContent() {
		return content;
	}

	/**
	 * 设置文本内容
	 * 
	 * @param content
	 * @see #content
	 */
	public void setContent(String content) {
		this.content = content;
	}

	/**
	 * 读取消息编号
	 * 
	 * @return
	 * @see #msgId
	 */
	public Long getMsgId() {
		return msgId;
	}

	/**
	 * 设置消息编号
	 * 
	 * @param msgId
	 * @see #msgId
	 */
	public void setMsgId(Long msgId) {
		this.msgId = msgId;
	}
	
	/**
	 * 消息类型
	 * 
	 * @author ultrafrog
	 * @version 1.0, 2014-12-29
	 * @since 1.0
	 */
	public static class MsgType {
		
		@Element("文本消息")
		public static final String TEXT		= "text";
		
		@Element("图片消息")
		public static final String IMAGE	= "image";
		
		@Element("语音消息")
		public static final String VOICE	= "voice";
		
		@Element("视频消息")
		public static final String VIDEO	= "video";
		
		@Element("地理位置消息")
		public static final String LOCATION	= "location";
		
		@Element("链接消息")
		public static final String LINK		= "link";
		
		@Element("事件消息")
		public static final String EVENT	= "event";
		
		@Element("图文消息")
		public static final String NEWS		= "news";
	}
}
